package contegor.scire.core.queries;

import contegor.scire.core.Connectable;

/**
 * Base {@link Condition} for all that, given a {@link Connectable}, can be give its weight: the {@link Connectable} accomplishment
 * level of the this {@link Condition}.
 * 
 * Usually {@link WeightCondition}s are composed by other {@link Condition}s, and all this are evaluated
 * when {@link WeightCondition#weight(Connectable)} is called. Then, the result is the number of those {@link Condition}s 
 * that evaluate to true with the given {@link Connectable}. {@link Condition} that are also {@link WeightCondition} will add its
 * weight value to the result. 
 */
public abstract class WeightCondition<C extends Connectable> extends Condition<C> {
  private static final long serialVersionUID = -943942546397045142L;

  /**
   * Returns the accomplishment level of the given {@link Connectable} to the conditions defined in this {@link WeightCondition}.
   */
  public abstract int weight(C connectable);
}
